from rest_framework import serializers
from .models import *


class CategorySer(serializers.ModelSerializer):
    class Meta:
        model = Category
        fields = "__all__"


class GoodsSer(serializers.ModelSerializer):
    class Meta:
        model = Goods
        fields = "__all__"


class TagSer(serializers.ModelSerializer):
    class Meta:
        model = Tag
        fields = "__all__"


class CartSer(serializers.ModelSerializer):
    class Meta:
        model = Cart
        fields = "__all__"


class GoodsCartSer(serializers.ModelSerializer):
    class Meta:
        model = Goods
        fields = ("id", "pic", "name", "price")


class CartListSer(serializers.ModelSerializer):
    goods = GoodsCartSer()

    class Meta:
        model = Cart
        fields = ("id", "num", "goods")